Skip to content

fix(clef-proxy): validate resolved model against Clef-family grammar (#2410) - #3426

Merged
dezren39 merged 1 commit into
mainfrom
queue/5287-2410-clef-model-grammar
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/5287-2410-clef-model-grammar

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Fixes #2410. Queue task 5287.

resolveModel returned any @cf/* string verbatim and interpolated any clef-containing string into @cf/cloudflare/<input> untouched; the result is interpolated raw into the gateway run URL and fetched with the proxy's token — so non-Clef models ran on a Clef-only proxy and ..///? payloads rewrote the upstream path/query.

Per the contract pinned by triage task 3592:

  • After alias resolution, the resolved model must match ^@cf/cloudflare/clef[A-Za-z0-9._-]*$ (Clef family, plain name characters only — no /, dot segments, ?, #, whitespace, or control characters are representable).
  • Failures are refused with HTTP 400 and the handler's existing JSON {error} shape, naming the refused model, before any upstream fetch.
  • Unchanged: missing/non-string model → clef-flash default; clef/clef-flash aliases; @cf/cloudflare/clef, clef-flash, clef-omni and future clef* names pass. The data path is deliberately NOT gated on the live model list (async/TTL display machinery for /v1/models).

Tests: new black-box block in bin/clef-proxy.test.mjs (spawned proxy + stub gateway) — 5 hostile inputs return 400 with zero upstream calls recorded; 5 controls reach the stub at the exact expected /workers-ai/run/<model> path. Full suite: node --test bin/clef-proxy.test.mjs — 26 pass, 0 fail (laptop).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 09:43
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 13 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ee4c5ee7-e0cb-49dd-be81-f603e99f23b8
Commits

Reviewing files that changed from the base of the PR and between ab6c84c and 006a2c5.

Files selected for processing: 2
  • bin/clef-proxy.mjs
  • bin/clef-proxy.test.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T08:45:13.945524Z 006a2c5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant